package com.vodone.v1pin.user.vo
{
	import com.vodone.v1pin.core.model.MainModelLocator;
	import com.vodone.v1pin.userInfo.delegate.UserInfoDelegate;
	import com.vodone.v1pin.userInfo.delegate.UserInfoUtil;
	
	[Bindable]
	public class UserLoginVO
	{
		/**
		 * 用户id
		 */		
		public var userId:String = "";
		/**
		 * v1用户id
		 */		
		public var oId:String = "";
		/**
		 * 用户名 
		 */		
		public var userName:String = "";
		private var _isLogin:Boolean = false;

		/**
		 * 用户名 
		 */
		public function get isLogin():Boolean
		{
			return _isLogin;
		}

		/**
		 * @private
		 */
		public function set isLogin(value:Boolean):void
		{
			_isLogin = value;
			if( value )
			{
				UserInfoDelegate.getUserInfo(getUserInfoResultHandler);
			}
			else
			{
				MainModelLocator.getInstance().userInfo = null;
			}
		}
		private function getUserInfoResultHandler( obj:Object ):void
		{
			MainModelLocator.getInstance().userInfo = UserInfoUtil.getInfoVOFromObj(obj["data"]);
		}

		/**
		 * 用户sessionId
		 */		
		public var sessionId:String;
	}
	
}